#region <!--##session ChangePasswordWholeClass##-->

		/*<!--##
		codeGeneratorVariable_DisplayCode.Append(GeneralUsing() + Environment.NewLine);
		##-->*/
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EXtremecode.PresentationLayer;	
using EXtremecode.Common.UI;
using EXtremecode.Common;
namespace <!--##=RepositoryManager.Instance.Repository.ProjectName##-->
{
		/*<!--##
		 codeGeneratorVariable_DisplayCode.Append(ChangePasswordCodeBehind() + Environment.NewLine);
		##-->*/
}
	
<!--##/session##-->
#endregion

#region <!--##session ChangePasswordCodeBehind##-->
		public partial class ChangePassword : ParentPage,IPage
	   {
		   protected void Page_Load(object sender, EventArgs e)
		   {
               IUser user = (SessionRepository.Instance.UserProfile == null) ? null :
                        SessionRepository.Instance.UserProfile.User;


               if (user != null)
               {
                   txtLogin.Value = user.UserId;
               }
		   }
           protected void btnChangePassword_Click(object sender, EventArgs e)
		   {
			       IUser user  = (SessionRepository.Instance.UserProfile == null)? null:
                        SessionRepository.Instance.UserProfile.User;


                  if(user != null)
                  {
                      //loggedin user
                      if (user.ChangePassword(txtOldPassword.Value, txtPassword.Value))
                      {
                          GeneralInformation = ResourceProvider.GetGeneralResourceString("Message_PasswordChanged");
                          Response.Redirect("~/Default.aspx");
                      }
                      else
                      {
                          txtOldPassword.Value = txtPassword.Value = txtConfirmPassword.Value = string.Empty;
                          lblErrorMessage.Text = ResourceProvider.GetGeneralResourceString("Message_OldPasswordNotValid");
                      }
                  }
                  else
                  {
                      //need to log on first.
                      Response.Redirect("~/Default.aspx");

                  }

			


			   }

 #region IPage Members

            BusinessObjectCollection IPage.BOCollection
            {
                get
                {
                    return null;
                }
            }

           public string EntityName
           {
               get
               {
                   return "ChangePassword";
               }
           }

           public MultiView MVMessage
           {
               get
               {
                   return null;
               }
           }

           public string ResourceName
           {
               get
               {
                   return "ChangePassword";
               }
           }

           #endregion
       }

<!--##/session##-->
#endregion



